package com.waffen.chemindelamemoire;

import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.google.android.gms.maps.GoogleMap.InfoWindowAdapter;
import com.google.android.gms.maps.model.Marker;

public class POIInfoWindowAdapter implements InfoWindowAdapter {

	private LayoutInflater inflater = null;

	public POIInfoWindowAdapter(LayoutInflater inflater) {
		this.inflater = inflater;
	}

	@Override
	public View getInfoContents(Marker marker) {

		View contentsView = inflater.inflate(R.layout.poi_windows_layout, null);

		ImageView image = (ImageView) contentsView
				.findViewById(R.id.image_poi_popup);

		image.setImageResource(MainActivity.context.getResources()
				.getIdentifier(
						MapFragment.listPoiMarker.get(marker).icon,
						"drawable", MainActivity.context.getPackageName()));

		TextView namepoi = ((TextView) contentsView
				.findViewById(R.id.name_poi_popup));
		namepoi.setText(marker.getTitle());

		TextView desc = ((TextView) contentsView
				.findViewById(R.id.desc_poi_popup));
		desc.setText(marker.getSnippet());

		TextView distance = ((TextView) contentsView
				.findViewById(R.id.dist_poi_popup));
		distance.setText("42 m");

		return contentsView;
	}

	@Override
	public View getInfoWindow(Marker marker) {
		return null;
	}

}
